package com.bjsxt.sm.users.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;
import com.bjsxt.sm.users.dao.IAcars;
import com.bjsxt.sm.users.pojo.Acars;
import com.bjsxt.sm.users.service.IAcarsService;

@Service("carsService")
public class IAcarsServiceImpl implements IAcarsService
{
	@Resource
	private IAcars cars;

	@Override
	public JSONObject updateOneCars(Acars cars)
	{
		JSONObject resultJSON = new JSONObject();
		int res = this.cars.updateCars(cars);
		if (res > 0)
		{
			JSONObject dataJSON = new JSONObject();
			dataJSON.put("effect", res);
			dataJSON.put("id",cars.getId());
			/* 存储的data也是一个json对象 */
			resultJSON.put("data", dataJSON);
			/* res:执行此SQL语句对数据库影响的条数;
			 * 成功 */
			resultJSON.put("code", "0");
			resultJSON.put("info", "成功");
		}else{
			resultJSON.put("code", "1");
			resultJSON.put("info", "失败");
		}
		return resultJSON;
	}

}
